#include "point.h"
#include "geometry.h"

#ifndef __M3DRIGIDBODY_H
#define __M3DRIGIDBODY_H

namespace m3d
{
#pragma pack( push, 1 )
	struct SMass
	{
		float			InverseMass;
		float			LinearDamping;
		float			AngularDamping;
		SMatrix3x3		InverseAngularMassTensor;
	};

	struct SForce
	{
		SVector3F		Velocity;
		SVector3F		Acceleration;
		SVector3F		Rotation;
	};

	struct SRigidBody
	{
		SMass		Mass;
		SForce		Force;
		SPivot		Pivot;
		STransform	LocalTransform;

		// ---- Accessors
		SVector3F	GetVelocity() const;
		SVector3F	GetAcceleration() const;
		SVector3F	GetRotation() const;
		float		GetInverseMass() const;
		float		GetLinearDamping() const;
		float		GetAngularDamping() const;
		SMatrix3	GetInverseAngularMassTensor() const;

		void		SetVelocity( float x, float y, float z );
		void		SetVelocity( const SVector3F& v );
		void		SetAcceleration( float x, float y, float z );
		void		SetAcceleration( const SVector3F& a );
		void		SetRotation( float x, float y, float z );
		void		SetRotation( const SVector3F& r );
		void		SetInverseMass( float m );
		void		SetLinearDamping( float d );
		void		SetAngularDamping( float d );
		void		SetInverseAngularMassTensor( const SMatrix3& m );
	};
#pragma pack( pop )
};

#endif _M3DRIGIDBODY_H
